home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 166 < prev    next >
Internet Message Format  |  1996-08-06  |  2KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2,comp.lang.eiffel,comp.std.c
  4. Subject: Re: Hungarian notation
  5. Followup-To: comp.std.c
  6. Date: 23 Jan 1996 08:02:21 -0600
  7. Organization: Usenet Fact Police (Undercover)
  8. Message-ID: <4e2ppd$lsu@solutions.solon.com>
  9. References: <30C40F77.53B5@swsbbs.com> <SPENCER.96Jan22113215@zorgon.ERA.COM> <4e1nd8$hv0@solutions.solon.com> <3104bfc8.132251392@nntp.ix.netcom.com>
  10. NNTP-Posting-Host: solutions.solon.com
  11.  
  12. In article <3104bfc8.132251392@nntp.ix.netcom.com>,
  13. Mike Rubenstein <miker3@ix.netcom.com> wrote:
  14. >seebs@solutions.solon.com (Peter Seebach) wrote:
  15. >> >   char a;
  16. >> >   int b;
  17.  
  18. >> >   int main()
  19. >> >   {
  20. >> >     b = -154267 ;
  21. >> >     a = b ;
  22. >> >     return 0 ;
  23. >> >   }
  24.  
  25. >> No warnings, perhaps, but undefined behavior unless CHAR_MIN is
  26. >> less than or equal to -154267.
  27.  
  28. >That does not result in undefined behavior.  From ISO 6.2.1.2:
  29.  
  30. >    When a value with integral type is demoted to a signed integer
  31. >    with smaller size or an unsigned integer is converted to its 
  32. >    corresponding signed integer, if the value cannot be 
  33. >    represented the result is implementation defined.
  34.  
  35. >An implementation must handle this and must document how it does so.
  36.  
  37. Cool!  A standard bug!
  38.  
  39. Appendix G.2, 2/3rds of the way down the page
  40.     -- An arithmetic conversion produces a result that cannot be
  41.        represented in the space provided. (6.2.1)
  42.  
  43. In reality, it's in 6.2.1.3 that the statement is made, and it only
  44. applies to floating->integer conversions.
  45.  
  46. Oops!  This is what I get for believing the standard's appendicies without
  47. confirmation.
  48.  
  49. Newsgroups now include comp.std.c, and followups go there.
  50.  
  51. -s
  52. -- 
  53. Peter Seebach - seebs@solon.com - Copyright 1995 Peter Seebach.
  54. C/Unix proto-wizard -- C/Unix questions? Send mail for help.  No, really!
  55. Using trn?  Weird new newsgroup problem?  I know the fix!  Email me!
  56. The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq - Not A Flying Toy
  57.